
**** Figure A.1 : number of open days

clear
use "$path\Intermediary Data\Open_Gazole_bydate_15.dta"
merge 1:1 date_tokeep using "$path\Intermediary Data\Open_Gazole_bydate_30.dta"
drop _merge
merge 1:1 date_tokeep using "$path\Intermediary Data\Open_Gazole_bydate_60.dta"
drop _merge

gen week=wofd(date_tokeep)
format week %tw

collapse number_open60 number_open30 number_open15, by(week)

keep if week>2447 & week<3064 // Drop 30 first and last observations

***** Open or not 
graph twoway (line number_open15 week , col("gs5") lwidth(0.75))(line number_open30 week , col("navy") lwidth(0.75)) (line number_open60 week , col("cranberry") lwidth(0.75) legend(order (1 "Open - 15 days threshold" 2 "Open - 30 days" 3 "Open - 60 days"))  graphregion(color(white)) xtitle("Date") ytitle("Number of open stations"))
graph export "$path\Graphs_Tables\Figure_A1.png", replace
graph export "$path\Graphs_Tables\Figure_A1.eps", replace


**** Figure A.2: 

clear
use "$path\Intermediary Data\Prix_Gazole30_Level_DailyFULL.dta"



collapse prix_ht, by(date_maj_num)
rename prix_ht mean_prix_ht30


gen week=wofd(date_maj_num)
format week %tw

collapse mean_prix_ht30, by(week)


merge 1:1 week using "$path\Intermediary Data\Weekly_data_NIPE.dta"
drop _merge 
merge 1:1 week using "$path\Intermediary Data\Brent_weekly.dta"
drop _merge
merge 1:1 week using "$path\Intermediary Data\Rotterdam_weekly.dta"
drop _merge
merge 1:1 week using "$path\Intermediary Data\eurusd_herokuapp_weekly"
drop _merge

*** Change unit of official after tax diesel prices
replace go_ht=go_ht*10


keep if week>2447 & week<3064 // Drop 30 first and last observations


replace brent=100*brent/(159*eurusd)
replace gasoline_rotterdam=100*gasoline_rotterdam/(159*eurusd)
replace diesel_rotterdam=100*diesel_rotterdam/(159*eurusd)

replace mean_prix_ht30=mean_prix_ht30/10
replace go_ht=go_ht/10

gen mdate = mofd(dofw(week)) 
format mdate %tm 
gen label = string(mdate, "%tm") + "w" + string(week) 

gen yy=substr(label,1,4)
destring yy, replace
bysort yy (week) : gen d = _n 
replace d=d+4 if yy==2007
 gen dateb=yy+(d-1)/52


**** Graph Gasoil/Rotterdam/Brent ****
graph twoway (line mean_prix_ht30 dateb , col("red") ) (line go_ht dateb , col("black") lpattern(longdash))(line diesel_rotterdam dateb , col("navy") ) (line brent dateb , col("navy") lpattern(dash)) ///
, legend(order (1 "Sample average price" 2 "Average price - Min. Econ." 3 "Rotterdam - Diesel"  4 "Brent"))  ///
graphregion(color(white)) xtitle("Date") ytitle("Euro cents per liter") ///
tlabel(2007(1)2019, labsize(small))  ylabel(15(10)80) 
graph export "$path\Graphs_Tables\Figure_A2.png", replace
graph export "$path\Graphs_Tables\Figure_A2.eps", replace

